package cn.glutnn;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class MyMenuItemActionListener implements ActionListener {

	Game game;

	public MyMenuItemActionListener(Game game) {
		this.game = game;
	}

	@Override
	public void actionPerformed(ActionEvent e) {

		String ac = e.getActionCommand();
		if ("初级".equals(ac)) {
			fn设置参数(10, 10);
		} else if ("中级".equals(ac)) {
			fn设置参数(15, 15);
		} else if ("高级".equals(ac)) {
			fn设置参数(20, 20);
		}
		
		game.uiMaker.fn计时功能结束();
		game.fn3初始化游戏界面();
	}

	public void fn设置参数(int $行, int $列) {
		UIMaker uiMaker = game.uiMaker;

		uiMaker.$总行数 = $行;
		uiMaker.$总列数 = $列;
		uiMaker.$格子数 = uiMaker.$总行数 * uiMaker.$总列数;
		uiMaker.$雷数 = uiMaker.$格子数 / 10;
		uiMaker.$剩余地雷个数 = uiMaker.$雷数;
		uiMaker.$剩余地雷个数value.setText("" + uiMaker.$剩余地雷个数);
		uiMaker.$状态value.setText("游戏中");
		uiMaker.$游戏时间value.setText("0秒");
	}

}
